package com.zhang.passer.controller;

import com.zhang.passer.service.SearchService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * 查询接口
 */
@RestController
@RequestMapping("/search")
public class SearchController {

    @Autowired
    SearchService searchService;

    /**
     * 根据关键字查询并获取结果
     * @param key
     * @return
     */
    @RequestMapping("/getResult/{key}")
    public Map<String, Object> getResult(@PathVariable String key){
        Map<String, Object> result = searchService.getSearchResult(key);
        return result;
    }

}
